Fix integer type in binary_code_transform#1356
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request modifies the binary_code_transform function in binary_code_transform.py to cast updated_parity to an integer when calculating the parity sign exponent, preventing potential type-related issues. There are no review comments, so I have no feedback to provide.
binary_code_transform
mhucka
left a comment
There was a problem hiding this comment.
Thank you for catching and fixing this!
on openfermion/transforms/opconversions/binary_code_transform.py line 163 it breaks (with numpy>2.) because (-1) ** updated_parity being updated_parity numpy.count_nonzero(fermionic_indices[:op_idx] < op_tuple[0]) line 146 (therefore a numpy.int) is not instance of int, as it is checked on openfermion/ops/operators/symbolic_operator.py line 124